package it.lupo.model;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

@Entity
@Table(name="lupo.conferments")
//@AttributeOverride(name="id",column=@Column(name="id"))
@IdClass(ConfermentId.class)
public class Conferment extends BaseEntity<Long> {
	
	private static final long serialVersionUID = -1226023719699254062L;
	
	
	@Id
	public Long id;
	@Id
	public int id_item;
	
	@Column
	@NotNull
	private Date timestamp;

	@OneToOne
	@NotNull
	private User operator;

	@OneToOne
	@NotNull
	private BarCode barcode;
	
	@OneToOne
	@NotNull
	private Type type;
	@Column
	@NotNull
	private Double ammount;
	@Column
	private String unit;
	@Column
	private boolean printed;
	
	
	
	
	public Conferment() {
		super();
	}
	public Conferment(Long id) {
		super(id);
	}
	
//	public Conferment(Date timestamp, User operator, BarCode barcode,
//			Type type, Double ammount, String unit, boolean printed) {		
//		this.timestamp = timestamp;
//		this.operator = operator;
//		this.barcode = barcode;
//		this.type = type;
//		this.ammount = ammount;
//		this.unit = unit;
//		this.printed = printed;
//	}
	
	public Conferment(Long id,int id_item,Date timestamp, User operator, BarCode barcode,
			Type type, Double ammount, String unit, boolean printed) {
		this.id=id;
		this.id_item=id_item;
		this.timestamp = timestamp;
		this.operator = operator;
		this.barcode = barcode;
		this.type = type;
		this.ammount = ammount;
		this.unit = unit;
		this.printed = printed;
	}
	 
	public Date getTimestamp() {
		return timestamp;
	}
	public void setTimestamp(Date timestamp) {
		this.timestamp = timestamp;
	}
	public User getOperator() {
		return operator;
	}
	public void setOperator(User operator) {
		this.operator = operator;
	}
	public BarCode getBarcode() {
		return barcode;
	}
	public void setBarcode(BarCode barcode) {
		this.barcode = barcode;
	}
	public Type getType() {
		return type;
	}
	public void setType(Type type) {
		this.type = type;
	}
	public Double getAmmount() {
		return ammount;
	}
	public void setAmmount(Double ammount) {
		this.ammount = ammount;
	}
	public String getUnit() {
		return unit;
	}
	public void setUnit(String unit) {
		this.unit = unit;
	}
	public boolean isPrinted() {
		return printed;
	}
	public void setPrinted(boolean printed) {
		this.printed = printed;
	};
	
	
	
	
}
